package com.phoenix.store.bi.controller;

import com.phoenix.store.bi.service.LoginHandler;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author alex
 */
@RestController
@AllArgsConstructor
@RequestMapping("login")
public class LoginController {

    private final Map<String, LoginHandler> loginHandlerMap;


    @GetMapping("type/{inStr}")
    public String getUserInfo(@PathVariable("inStr") String inStr) {
        String[] inStrs = inStr.split("@");
        String type = inStrs[0];
        return loginHandlerMap.get(type).getName();
    }

}
